package cn.iocoder.yudao.module.system.api.a_gaojian;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.service.a_article.ArticleService;
import cn.iocoder.yudao.module.system.service.a_audio_and_video.AudioAndVideoService;
import cn.iocoder.yudao.module.system.service.a_pictures.PicturesService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class GaoJianApiImpl implements GaoJianApi {

    @Resource
    private ArticleService articleService;
    @Resource
    private AudioAndVideoService audioAndVideoService;
    @Resource
    private PicturesService picturesService;


    @Override
    public CommonResult<Boolean> updateReview(String id, String dataType,Integer reviewStatus) {
        if ("article".equals(dataType)) {
            return success(articleService.updateReview(id, reviewStatus));

        } else if ("video".equals(dataType) || "audio".equals(dataType)) {
            return success(audioAndVideoService.updateReview(id, reviewStatus));

        } else if ("picture".equals(dataType)) {
            return success(picturesService.updateReview(id, reviewStatus));

        }
        return success(false);
    }


}
